import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';

export default async function a003(fd: IFeidaoAiBrowserComponent, val:
	{
		company_no: string,
		high_company_name: string
	}) {
	// todo 点击新增确定
	const company_name = fd.data.node.querySelector<HTMLInputElement>('[data-id="gsmc"]').value;
	// 引用公司名称
	const high_company_name = fd.data.node.querySelector<HTMLInputElement>('[data-id="high_company_name"]').value;
	const corporate = fd.data.node.querySelector<HTMLInputElement>('[data-id="fr"]').value;
	const contacts_tel_one = fd.data.node.querySelector<HTMLInputElement>('[data-id="frlx"]').value;
	const company_unity_code = fd.data.node.querySelector<HTMLInputElement>('[data-id="qydm"]').value;
	const org_code = fd.data.node.querySelector<HTMLInputElement>('[data-id="zzjg"]').value;
	const nrollment_registration = fd.data.node.querySelector<HTMLInputElement>('[data-id="gszc"]').value;
	const contacts_tel_two = fd.data.node.querySelector<HTMLInputElement>('[data-id="qylxr"]').value;
	const contact = fd.data.node.querySelector<HTMLInputElement>('[data-id="lxr"]').value;
	const business_address = fd.data.node.querySelector<HTMLInputElement>('[data-id="gsdz"]').value;
	const res = await nodejs<{ code: number }>('company-factory/zj-000002/s001',
		{
			company_name,
			high_company_name,
			corporate,
			contacts_tel_one,
			company_unity_code,
			org_code,
			nrollment_registration,
			contacts_tel_two,
			contact,
			business_address
		});
	if (res.code === 1) {
		alert("保存成功");
	} else {
		alert("保存失败");
	}
}
